/*
 * Copyright 2007-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mx.jdbc.ymate.config;

import javax.validation.constraints.NotNull;

/**
 * @author 刘镇 (suninformation@163.com) on 2019-07-26 12:08
 * @since 2.1.0
 */
public final class DataSourceConfig {

    // 数据源名称 必填参数  跟dsNamelist对应
    @NotNull
    private String name;

    //数据库访问用户名称, 必填参数
    @NotNull
    private String username;

    //数据库访问密码, 可选参数
    private String password;

    //数据库访问密码是否已加密
    private Boolean passwordEncrypted = false;

    //数据库密码处理器, 可选参数, 用于对已加密码数据库访问密码进行解密, 默认值:
    private String passwordClass;

    //数据库表前缀名称, 默认值: 空
    private String tablePrefix;

    //数据源适配器, 可选值为已知适配器名称或自定义适配置类名称, 默认值: default, 目前支持已知适配器[default|dbcp|c3p0|jndi|...]
    private String adapterClass;

    //数据源适配器配置文件，可选参数，若未设置或设置的文件路径无效将被忽略，默认值为空
    private String configFilePath;

    //数据库类型, 可选参数, 默认值将通过连接字符串分析获得, 目前支持[mysql|oracle|sqlserver|db2|sqlite|postgresql|hsqldb|h2]
    private String type;

    //数据库方言, 可选参数, 自定义方言将覆盖默认配置
    private String dialectClass;

    //数据库连接驱动, 可选参数, 框架默认将根据数据库类型进行自动匹配
    @NotNull
    private String driverClass;

    //数据库连接字符串, 必填参数
    @NotNull
    private String connectionUrl;

    //是否显示执行的SQL语句, 默认值: false
    private Boolean showSql = false;

    //是否开启堆栈跟踪, 默认值: false
    private Boolean stackTraces;

    //堆栈跟踪层级深度, 默认值: 0(即全部)
    private int stackTraceDepth;

    //堆栈跟踪包名前缀过滤, 默认值: 空
    private String stackTracePackages;

    //自定义引用标识符
    private String identifierQuote;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Boolean isPasswordEncrypted() {
        return passwordEncrypted;
    }

    public void setPasswordEncrypted(Boolean passwordEncrypted) {
        this.passwordEncrypted = passwordEncrypted;
    }

    public String getPasswordClass() {
        return passwordClass;
    }

    public void setPasswordClass(String passwordClass) {
        this.passwordClass = passwordClass;
    }

    public String getTablePrefix() {
        return tablePrefix;
    }

    public void setTablePrefix(String tablePrefix) {
        this.tablePrefix = tablePrefix;
    }


    public String getAdapterClass() {
        return adapterClass;
    }

    public void setAdapterClass(String adapterClass) {
        this.adapterClass = adapterClass;
    }

    public String getConfigFilePath() {
        return configFilePath;
    }

    public void setConfigFilePath(String configFilePath) {
        this.configFilePath = configFilePath;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDialectClass() {
        return dialectClass;
    }

    public void setDialectClass(String dialectClass) {
        this.dialectClass = dialectClass;
    }

    public String getDriverClass() {
        return driverClass;
    }

    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    public String getConnectionUrl() {
        return connectionUrl;
    }

    public void setConnectionUrl(String connectionUrl) {
        this.connectionUrl = connectionUrl;
    }

    public Boolean isShowSql() {
        return showSql;
    }

    public void setShowSql(Boolean showSql) {
        this.showSql = showSql;
    }

    public Boolean isStackTraces() {
        return stackTraces;
    }

    public void setStackTraces(Boolean stackTraces) {
        this.stackTraces = stackTraces;
    }

    public int getStackTraceDepth() {
        return stackTraceDepth;
    }

    public void setStackTraceDepth(int stackTraceDepth) {
        this.stackTraceDepth = stackTraceDepth;
    }

    public String getStackTracePackages() {
        return stackTracePackages;
    }

    public void setStackTracePackages(String stackTracePackages) {
        this.stackTracePackages = stackTracePackages;
    }

    public String getIdentifierQuote() {
        return identifierQuote;
    }

    public void setIdentifierQuote(String identifierQuote) {
        this.identifierQuote = identifierQuote;
    }
}
